package org.example.scenicspot.controller;

import org.example.scenicspot.domain.EmergencyRescuePerson;
import org.example.scenicspot.domain.EmergencyRescueVehicle;
import org.example.scenicspot.service.emergencyRescuePersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/")

public class emergencyRescuePersonController {
    @Autowired
    private emergencyRescuePersonService emergencyRescuePersonService;
    @GetMapping("/emergencyRescuePerson")
    public List<EmergencyRescuePerson> showemergencyRescuePerson(){
        return emergencyRescuePersonService.showemergencyRescuePerson();
    }

    @GetMapping ("/searchemergencyRescuePerson")
    public List<EmergencyRescuePerson> searchemergencyRescuePerson(String keyword){
        return emergencyRescuePersonService.searchemergencyRescuePerson(keyword);
    }

    @GetMapping ("/selectemergencyRescuePersonbyscenicareaid")
    public List<EmergencyRescuePerson> selectemergencyRescuePersonByScenicAreaID(int scenicareaid){
        return emergencyRescuePersonService.selectByScenicAreaID(scenicareaid);
    }

    @GetMapping ("/deleteemergencyRescuePerson")
    public void deleteemergencyRescuePerson(int id){
        emergencyRescuePersonService.deleteemergencyRescuePerson(id);
    }

    @PostMapping("/insertemergencyRescuePerson")
    public void insertemergencyRescuePerson(@RequestBody EmergencyRescuePerson emergencyRescuePerson){
        emergencyRescuePersonService.insertemergencyRescuePerson(emergencyRescuePerson);
    }

    @PostMapping ("/updateemergencyRescuePerson")
    public void updateemergencyRescuePerson(@RequestBody EmergencyRescuePerson emergencyRescuePerson){
        emergencyRescuePersonService.updateemergencyRescuePerson(emergencyRescuePerson);
    }
}
